<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"> 
    
    <h:body>
        <ui:composition template="../template.xhtml">

            <ui:define name="content">
				<p:panel header="Pacchetto Personalizzato" style="text-align:center">  
		            <h:panelGrid columns="1" style="width:100%">  
		            
		                <h:outputText value="#{packetFrontend.current.place.name}" />  
			                
		                <ul>
		                	<ui:repeat value="#{packetFrontend.current.products}" var="p">
		                	<li>
		                		<h:panelGroup layout="block"  rendered="#{p.excursion!=null}">
								    <b>Escursione:</b> 
								    #{p.excursion.name} 
					            	<h:outputText value="#{excursion.date}">
									    <f:convertDateTime pattern="dd/MM/yyyy" type="date" />
									</h:outputText>
									- 
									#{p.price} &euro;
				            	</h:panelGroup> 
				            	
				            	<h:panelGroup layout="block"  rendered="#{p.hotel!=null}">
								    <b>Hotel:</b> 
								    #{p.hotel.name} (#{p.hotel.stars} stelle) - 
								    dal
					            	<h:outputText value="#{p.hotel.checkInDate}">
									    <f:convertDateTime pattern="dd/MM/yyyy" type="date" />
									</h:outputText>
									al
					            	<h:outputText value="#{p.hotel.checkOutDate}">
									    <f:convertDateTime pattern="dd/MM/yyyy" type="date" />
									</h:outputText>
									- 
									#{p.price} &euro;
				            	</h:panelGroup> 
				            	
				            	<h:panelGroup layout="block"  rendered="#{p.flight!=null}">
								    <b>Volo:</b> 
								    Da 
					                #{p.flight.place.name} - 
					            	<h:outputText value="#{p.flight.departureDate}">
									    <f:convertDateTime pattern="dd/MM/yyyy" type="date" />
									</h:outputText>
					                 
									a
					                #{p.place.name} - 
					            	<h:outputText value="#{p.flight.arrivalDate}">
									    <f:convertDateTime pattern="dd/MM/yyyy" type="date" />
									</h:outputText>
									-
									#{p.price} &euro;
				            	</h:panelGroup> 
		                	</li>
		                	</ui:repeat>
			                <li><b>Prezzo Totale:</b> #{packetFrontend.current.price} &euro;</li>
		                </ul>
		  
		                <h:form>
							<p:commandButton value="Prenota Ora"   action="#{packetFrontend.bookAction()}" />
						</h:form>
		                  
		            </h:panelGrid>  
		        </p:panel> 
				
			</ui:define>
        </ui:composition>
    </h:body>
</html>
